package com.example.a_java.config;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.License;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.security.SecurityScheme;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SwaggerConfig {
    
    @Bean
    public OpenAPI springShopOpenAPI() {
        return new OpenAPI()
                .info(new Info()
                        .title("贷款管理系统接口文档")
                        .description("本文档描述了贷款管理系统后端服务的接口规范")
                        .version("1.0.0")
                        .contact(new Contact()
                                .name("技术团队")
                                .email("support@example.com")
                                .url("http://www.example.com"))
                        .license(new License()
                                .name("使用条款")
                                .url("http://www.example.com/terms")))
                .externalDocs(new ExternalDocumentation()
                        .description("系统设计文档")
                        .url("http://www.example.com/docs"))
                .components(new Components()
                        .addSecuritySchemes("bearer-key",
                                new SecurityScheme()
                                        .type(SecurityScheme.Type.HTTP)
                                        .scheme("bearer")
                                        .bearerFormat("JWT")
                                        .description("请输入JWT Token")));
    }
} 